package configuration;

import org.yaml.snakeyaml.Yaml;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;

/**
 * Created by wzl on 19-12-23.
 */
public class DemoConfig {
    private boolean demo;
    private String cycle_nums;

    public boolean getDemo() {
        return demo;
    }

    public void setDemo(boolean demo) {
        this.demo = demo;
    }

    public String getCycle_nums() {
        return cycle_nums;
    }

    public void setCycle_nums(String cycle_nums) {
        this.cycle_nums = cycle_nums;
    }

    public static DemoConfig initFromFile(String filepath) throws FileNotFoundException {
        Yaml yaml = new Yaml();
        DemoConfig config = yaml.loadAs(new FileInputStream(new File(filepath)),
                DemoConfig.class);
        return config;
    }

    @Override
    public String toString() {
        return "DemoConfig {" +
                "\ndemo = " + demo +
                "\ncycle_nums = " + cycle_nums +
                "\n}";
    }
}
